
#include <iostream>
#include <vector>


namespace pc
{
	template <class T>
	class stack
	{
	public:
		stack()
		{

		}
		void push(const T& data)
		{
			data_.push_back(data);
		}
		void pop()
		{
			if (!data_.empty())
			{
				data_.pop_back();
			}
		}
		T& top()
		{
			return data_.back();
		}

		bool top(T* data)
		{
			if (!data_.empty())
			{
				*data = data_.back();
				return true;
			}
			return false;
		}
		const T& top() const
		{
			return data_.back();
		}
		size_t size() const
		{
			return data_.size();
		}
		bool empty() const
		{
			return data_.empty();
		}
		void display() const
		{
			for (const T& data : data_)
			{
				std::cout << data << " ";
			}
			std::cout << std::endl;
		}
	private:
		std::vector<T> data_;
	};
}